home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Mac OS Development Toolkit / Automation Essentials 2.3.0 / Host Automation Folder / SPEC Libs / Globals.Lib < prev    next >
Encoding:
Text File  |  1998-03-19  |  24.9 KB  |  579 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:    Globals.Lib
  5. #
  6. #    Contains:    Used to define globals
  7. #
  8. #    Written by:    KTA, ML, et al
  9. #
  10. #    Copyright:    © 1993-1996 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #    1.1.212>     6/18/96    MDF        Added global gIsBothMethods to correctly         handle both
  19. #                                    test case logging methods.
  20. #    .1.211+>     6/18/96    MDF        Added global gIsBothMethods to correctly handle both test case
  21. #                                    logging methods.
  22. #    1.1.211>     6/17/96    MDF        Modified comparisons of gTestCaseLoggingMethod against it's
  23. #                                    possible values.
  24. #    .1.210+>     6/17/96    MDF        
  25. #    1.1.210>     6/17/96    MDF        Modified checks for gTestCaseLoggingMethod         against
  26. #                                    ResultsExpress reporting versus         Tracs reporting.
  27. #    1.1.29+>     6/17/96    MDF        Modified checks for gTestCaseLoggingMethod against
  28. #                                    ResultsExpress reporting versus Tracs reporting.
  29. #    <1.1.29>     2/23/96    JC        Add TRACS support.
  30. #    1.1.28+>     2/23/96    JC        Add TRACS support.
  31. #    <1.1.28>    11/13/95    ML        InitGlobals() - add initing TCSlogging constants
  32. #    1.1.27+>    11/13/95    ML        InitGlobals() - add initing TCSlogging constants
  33. #    <1.1.27>     5/18/95    ML        corrected SPEC version
  34. #    1.1.26+>     5/18/95    ML        corrected SPEC version
  35. #    <1.1.26>     5/18/95    ML        changed SPECVersion to global gSPECVersion         for Clouseau
  36. #                                    compatibility checking
  37. #    1.1.25+>     5/18/95    ML        changed SPECVersion to global gSPECVersion for Clouseau
  38. #                                    compatibility checking
  39. #    <1.1.25>      5/8/95    ML        Removed global gLogStrCount - now we check it in logstr().
  40. #    <1.1.24>     3/29/95    ML        InitGlobals() - Don't default gAdditionalTargetInfo,
  41. #                                    gPrintSuiteInfo to ON
  42. #    1.1.23+>     3/29/95    ML        
  43. #    <1.1.23>     3/14/95    ML        InitGlobals() - add gAdditionalTargetInfo,
  44. #                                    gSpecialErrorHandlers, gPrintSuiteInfo, gLaunchReqs
  45. #    1.1.22+>     3/14/95    ML        
  46. #    <1.1.22>     3/13/95    ML        set gVerifyAppPriorToLaunch on by default
  47. #    1.1.21+>     3/13/95    ML        
  48. #    <1.1.21>     3/10/95    ML        InitGlobals() - Remove incorrect "not" from SPEC_1_2_based
  49. #                                    check, correctly set SPEC_1_2_based, check if
  50. #                                    gExceptionHandlerList is defined
  51. #    1.1.20+>      3/9/95    ML        InitGlobals () - remove incorrect "not"
  52. #    <1.1.20>     2/28/95    KTA        InitGlobals() - Added gMacroCommands to the list that can be
  53. #                                    passed in with pGlobalsDefList.
  54. #    <1.1.19>     2/28/95    ML        Marked
  55. #    <1.1.18>     2/23/95    KTA        SetTestLevel() - Fixed example in header and added more detail
  56. #                                    about test methods / InitGlobals() - Added more information
  57. #                                    about parameters to the header
  58. #    <1.1.17>     2/16/95    ML        InitGlobals() - Make sure command timeout set to 130
  59. #    <1.1.16>     2/16/95    ML        InitGlobals() - don't add new error handlers if gCrashHandling
  60. #                                    is off
  61. #    <1.1.15>      2/6/95    ML        InitGlobals() - default gCrashHandling to ON if undefined,
  62. #                                    default pGlobalsDefList to undefined, added check for pre 1.2
  63. #                                    script, initialize different gExceptionHandlerList if pre 1.2
  64. #                                    script, Added global gSPECVersion and pass into suite desc, if
  65. #                                    not(global gCrashHandling) , AddExceptionHandler for -1096
  66. #    <1.1.14>      2/1/95    KTA        Added crashHandler parameters
  67. #    <1.1.13>     1/31/95    KTA        InitGlobals() - Added gCrashHandling.
  68. #    <1.1.12>     1/31/95    KTA        Added gInitGlobalsThreadingHook
  69. #    <1.1.11>     1/31/95    KTA        Changed CrashHandler.Lib toCrashHandling.lib
  70. #    <1.1.10>     1/27/95    KTA        SetTestLevel() - fixed illegal Expression in 'WindowLevel' /
  71. #                                    InitGlobals() - Added -1100 exceptionhandler for the
  72. #                                    crashHandler
  73. #     <1.1.9>     1/27/95    ML        Set correct command timeouts for exception handling
  74. #     <1.1.8>     1/25/95    ML        Correct typo when defining gAppVerify
  75. #     <1.1.7>     1/19/95    ML        Default commandExceptions to ON.  Change gErrorList to
  76. #                                    gExceptionHandlerList.  Change DefaultErrorHandler to
  77. #                                    DefaultExceptionHandler
  78. #     <1.1.6>     1/19/95    KTA        Added a crashHandler to the default gErrList.
  79. #     <1.1.5>      1/9/95    KTA        SetTestLevel(), InitRandomSeed() -    Changed Println calls to
  80. #                                    Logstr() calls.
  81. #     <1.1.4>    12/13/94    KTA        Move ExitVU to  TCS.Lib
  82. #     <1.1.3>    12/13/94    ML        Major globals optimizations (see individual tasks headers)
  83. #     <1.1.2>     9/21/94    ML        Revise Gestalt check for system version for VU 2.1 support,
  84. #                                    temporarily add global for VU version and add VU version info to
  85. #                                    Suite info
  86. #     <1.1.1>     7/15/94    ML        Correct globals declarations in InitRandomSeed()
  87. #     <1.1.0>      5/4/94    KTA        InitGlobals() - Font lists and Scrapbook are no longer 
  88. #                                    defined in resources. Removed BuildListFromResource().
  89. #    1.0.115>     4/20/94    ML        Marked tasks
  90. #    1.0.114>     4/15/94    KTA        InitGlobals() - Check to insure gLogLevel and gTCTracking are
  91. #                                    undefined prior to assigning default values.
  92. #    1.0.113>     4/13/94    KTA        InitGlobals() - changed gDBLogging to gTCTracking.
  93. #    <1.0.112>     12/16/93    KTA        Changed gFileToolOutput to gTestCaseLoggingMethod
  94. #    <1.0.111>     12/14/93    KTA        Removed Palantino from default gFontList. 
  95. #    <1.0.110>     12/2/93    KTA        Fixed bug where it was not possible to set the randomSeed value
  96. #                                    from the Custom.Lib.
  97. #    <1.0.19>     9/23/93    KTA        Moved gPreflight from TCS.Lib so it would be initialized at the
  98. #                                    right time.
  99. #    <1.0.18>     9/22/93    KTA        Removed global gStopTimer it was not used, removed gScriptLevel
  100. #                                    from globals, removed kScrapStyledTEXT, etc.
  101. #    <1.0.17>     9/13/93    KTA        Updated TestLevel specification.
  102. #    <1.0.16>     9/10/93    KTA        Added a definable test level for application specific tests -
  103. #                                    gAppTestLevel.
  104. #    <1.0.15>      9/2/93    KTA        Fixed example in SetTestLevel()
  105. #    <1.0.14>      9/1/93    KTA        Added task ExitVU, and task reference to it - gExitVU.
  106. #    <1.0.13>     8/25/93    KTA        Added support for parity checking the TCS stack and Script
  107. #                                    parameter to set test level.
  108. #    <1.0.12>     8/20/93    KTA        Moved TCS specific Globals, added gFileToolOutput and
  109. #                                    gNoteBookOutput for FileTool output of Phoenix data.
  110. #    <1.0.11>     7/20/93    KTA        Bug Fix: I wiped out gBuildVers when fixing gIsSys7.
  111. #    <1.0.10>     7/19/93    KTA        Added customiation support: Dependancy on Custom.lib, call
  112. #                                    InitCustom().
  113. #     <1.0.9>     7/15/93    KTA        Added TCSExpCount, and made a better check for gIsSys7 (for
  114. #                                    PowerPC).
  115. #     <1.0.8>     7/14/93    KTA        Place some global variable strings into resources for
  116. #                                    international support. gScraptitle, gFontlist, gFontStyleList,
  117. #                                    gFontSizeList.
  118. #        <1+>     5/21/93    NAGA        Adding header and porting old files to follow new standards
  119. #
  120. # ****************************************************************************
  121. #
  122.  
  123. ########################################################################
  124. #                            External libraries 
  125. #=======================================================================
  126. Libraries "Custom.Lib", "ExceptionHandling.Lib", "Output.Lib", "CrashHandling.Lib", "TRACS.Lib";
  127.  
  128. #########################################################################
  129. ####################            GLOBALS                #####################
  130. #########################################################################
  131. ### Global Library Definitions
  132. ###        Generally:
  133. ###        If current value is 0 or 1, new value must be a 0 or 1
  134. ###        If current value is true or false, new value must be true or false
  135. ###        If current value is a string, new value must be a string
  136. ###        If current value is a list, new value must be a list.
  137. ###
  138. #########################################################################
  139. #########################################################################
  140. #                            InitGlobals()
  141. #========================================================================
  142. # Author:        KTA
  143. # Description:    Initializes most global variables used by the SPEC S&L.  
  144. #                This Task should be called prior to making any calls to 
  145. #                any tasks contained within the SPEC S&L Libraries
  146. #                Please refer to 'The Hitchhikers Guide' for more information 
  147. #                concerning any individual global.
  148. # Parameters:    pTheScriptParam - (list or integer)
  149. #                                - list - contains both parameters to SetTestLevel() 
  150. #                                - integer - only first parameter to SetTestLevel()
  151. #                                    (see SetTestLevel() header for more details)
  152. #
  153. #                pGlobalsDefList - list of lists with each inner list containing a 
  154. #                                label (string - name of the global) and a value for the global.            
  155. #                                This enables the user to define globals through VU's 
  156. #                                interface for individual scripts without having to
  157. #                                modify any SPEC S&L files (i.e. Custom.Lib)
  158. #                                
  159. #                                By providing a definition for a global, you will only 
  160. #                                effect that specific global, all other globals are 
  161. #                                given default values. 
  162. #                                
  163. #                                The globals which can be defined are as follows:
  164. #                                1) gCommandExceptions        2) gExceptionHandlerList
  165. #                                3) gCrashHandling            4) gAppVerify
  166. #                                5) gTestCaseLoggingMethod    6) gDebugFlag
  167. #                                7) gTextStr                    8) kScrapTEXT
  168. #                                9) kScrapPICT                10) gScrapTitle
  169. #                                11) gAliasDirectory            12) gTCTracking
  170. #                                13) gPreFlight                14) gFontList
  171. #                                15) gFontSizeList            16) gFontStyleList
  172. #                                17) gSFPUTLocation            18) gPrintTest
  173. #                                19) gDoWindowList            20) gBackgroundQuit
  174. #                                21) gForceQuit                22) gSeedValue
  175. #                                23) gMacroCommands            24) gAdditionalTargetInfo
  176. #                                25) gSpecialErrorHandlers    26) gPrintSuiteInfo
  177. #                                27) gLaunchReqs
  178. # Returns:        Nothing
  179. # Examples:        InitGlobals({2, {{'DrawLevel', 1}}}, {{'gSeedValue', 1542}, {'gCrashHandling', false}});
  180. # Assumptions:     
  181. #========================================================================
  182. # History:
  183. # KTA    7/8/93    Added String Resources  (intl) 
  184. # KTA     7/14/93    Updated gIsSys7 check for PowerPC
  185. # KTA     4/13/94    Changed gDBLogging to gTCTracking
  186. # KTA     4/15/94    Check to insure gLogLevel and gTCTracking are undefined prior
  187. #                to assigning default values.
  188. # KTA     5/4/94    Font lists and Scrapbook are no longer defined in resources.
  189. # ML    9/21/94    Revise Gestalt check for system version for VU 2.1 support
  190. # ML    9/21/94 temporarily add global for VU version and add to suite info
  191. #                - remove when 2.1 ships!
  192. # ML    12/9/94    removed gTargetCheck, gNoteBookOutput,
  193. #                        gExitVU, gLogLevel, gDisableAllLogging,
  194. #                        gFillMemory, gFillMemApp, gSeedZero, gAppTitle
  195. #                        gAppVersion, gPrevAppTitle, gSFOriginalPath
  196. # ML    12/13/94 removed system version and PowerPC checks - moved to
  197. #                 InitTCSlogging.
  198. #                 Removed VU version checks - obsolete
  199. # ML     12/13/94 Added gCommandExceptions and gErrorList
  200. # ML     1/19/95  CommandExceptions default to on
  201. #                 Change gErrorList to gExceptionHandlerList
  202. #                 Change DefaultErrorHandler to DefaultExceptionHandler
  203. # ML    1/25/95  Correct typo when defining gAppVerify
  204. # ML    1/27/95     Set correct command timeouts for exception handling
  205. # ML    1/31/95     Added gInitGlobalsThreadingHook
  206. # ML    1/31/95     Added global gCrashHandling
  207. # ML    2/3/95     default gCrashHandling to ON if undefined
  208. #                 default pGlobalsDefList to undefined
  209. #                 added check for pre 1.2 script
  210. #                 initialize different gExceptionHandlerList if pre 1.2 script
  211. #                 Added global gSPECVersion and pass into suite desc
  212. #                 if not(global gCrashHandling) AddExceptionHandler for -1096
  213. # ML    2/16/95     don't add new error handlers if gCrashHandling is off
  214. # ML    2/16/95     InitGlobals() - Make sure command timeout set to 130
  215. # KTA     2/22/95     Added more information about parameters to the header
  216. # KTA     2/28/95     Added gMacroCommands to the list that can be passed in.
  217. # ML    3/9/95     Remove incorrect "not" from SPEC_1_2_based check
  218. #                 correctly set SPEC_1_2_based, check if gExceptionHandlerList
  219. #                 is defined
  220. # ML    3/13/95     set gVerifyAppPriorToLaunch on by default
  221. # ML    3/14/95     add gAdditionalTargetInfo, gSpecialErrorHandlers,
  222. #                 gPrintSuiteInfo, gLaunchReqs
  223. # ML    3/29/95     Don't default gAdditionalTargetInfo, gPrintSuiteInfo to ON
  224. # ML    5/8/95     Removed global gLogStrCount - now we check it in logstr()
  225. # ML    5/18/95     changed SPECVersion to global gSPECVersion for Clouseau
  226. #                 compatibility checking
  227. # ML    11/13/95 add initializing kTCSNoLoggingMethod and kTCSResultsExpressMethod
  228. # JC     2/20/96 Added global kTCS_TRACSFileToolMethod for TRACS support also added 
  229. #                 a call to TRACS_DataCollection() with pTheScriptParam parameter.
  230. # MDF    06/17/96 Changed value of global kTCS_TRACSFileToolMethod to 2
  231. #                 (distinguish from value of global kTCSResultsExpressMethod).
  232. #                 Tracs reporting now default if gTestCaseLoggingMethod is left
  233. #                 undefined in pGlobalsDefList.
  234. # MDF    06/18/96 Added global gIsBothMethods to correctly handle both test case
  235. #                 logging methods.
  236. #########################################################################
  237. TASK InitGlobals(pTheScriptParam := -1, pGlobalsDefList := undefined) 
  238. begin
  239.  
  240.     ## are we in a pre-1.2 based script - if so, pGlobalsDefList
  241.     ## won't be defined
  242.     if (IsUndefined (pGlobalsDefList))
  243.     begin
  244.         SPEC_1_2_based := 0;
  245.         pGlobalsDefList := {};
  246.     end;
  247.     else
  248.         SPEC_1_2_based := 1;
  249.     
  250.     ############## Exception Handling Globals ############
  251.     ## Command Exception dictates whether VU will automatically throw VU Errors. 
  252.     global gCommandExceptions := assoc('gCommandExceptions',pGlobalsDefList);
  253.     if (IsUndefined (gCommandExceptions))
  254.         global gCommandExceptions                 := 1;                    # 1 to verify the application is expected
  255.     CommandExceptions(gCommandExceptions);
  256.     
  257.     ## This list defines the tasks which will handle different errors
  258.     ##    If you have a need to change the default settings at runtime, you 
  259.     ##  should call AddExceptionHandler() and RemoveExceptionHandler()
  260.     global gExceptionHandlerList := assoc('gExceptionHandlerList',pGlobalsDefList);
  261.     if (IsUndefined (gExceptionHandlerList))
  262.         if (SPEC_1_2_based) # for SPEC 1.2 based scripts
  263.             global gExceptionHandlerList := 
  264.             {
  265.                 {-1096, {task DefaultCrashHandler, {1,1,1},1}},            # Target Restarted
  266.                 {-1100, {task DefaultCrashHandler, {1,1,1},1}},            # Target crashed
  267.                 {'Default', {task DefaultExceptionHandler, {1},0}}        # Everything else
  268.             };
  269.         else # pre SPEC 1.2 scripts don't have a catch
  270.             global gExceptionHandlerList := 
  271.             {
  272.                 {-1096, {task DefaultCrashHandler, {1,1,1,-1096},0}},    # Target Restarted
  273.                 {-1100, {task DefaultCrashHandler, {1,1,1,-1100},0}},    # Target crashed
  274.                 {'Default', {task DefaultExceptionHandler, {1},0}}        # Everything else
  275.             };
  276.     
  277.     global gCrashHandling := assoc('gCrashHandling',pGlobalsDefList);
  278.     if (IsUndefined (gCrashHandling))
  279.         global gCrashHandling := 1;
  280.         
  281.     global gMacroCommands := assoc('gMacroCommands',pGlobalsDefList);
  282.     if (IsUndefined (gMacroCommands))
  283.         global gMacroCommands := 'HOW; WH; TD; HT; SC';
  284.         
  285.     global gSpecialErrorHandlers := assoc('gSpecialErrorHandlers',pGlobalsDefList); # to install any special error handlers
  286.         
  287.     ############## Misc Globals ############
  288.     global gAppVerify := assoc('gAppVerify',pGlobalsDefList);
  289.     if (IsUndefined (gAppVerify))
  290.         global gAppVerify             := 1;                    # 1 to verify the application is expected
  291.     
  292.     global gVerifyAppPriorToLaunch := assoc('gVerifyAppPriorToLaunch',pGlobalsDefList);
  293.     if (IsUndefined (gVerifyAppPriorToLaunch))
  294.         global gVerifyAppPriorToLaunch             := 1;                    # 1 to verify the application alias is expected
  295.  
  296.     global gAdditionalTargetInfo := assoc('gAdditionalTargetInfo',pGlobalsDefList);
  297.  
  298.     global gPrintSuiteInfo := assoc('gPrintSuiteInfo',pGlobalsDefList);
  299.  
  300.     global gTestCaseLoggingMethod     := assoc('gTestCaseLoggingMethod',pGlobalsDefList);
  301.     if(IsUndefined (gTestCaseLoggingMethod))
  302.         global gTestCaseLoggingMethod := 2;
  303.         
  304.     global gSPECVersion := '1.3';
  305.     SPECVersionString := "SPEC S&L {gSPECVersion}";
  306.     global gAddSuiteInfoFieldsRE    := {{ 'Desc', SPECVersionString}};
  307.     
  308.     ############## Misc constants ############
  309.     global gDebugFlag                 := assoc('gDebugFlag',pGlobalsDefList);
  310.     global gTextStr                 := assoc('gTextStr',pGlobalsDefList);
  311.     if not (gTextStr)
  312.         global gTextStr := "How jumping gymnasts will level six piqued frogs, Jim!";
  313.  
  314.     ############## ScrapBook Constants ############
  315.     global kScrapTEXT                 := assoc('kScrapTEXT',pGlobalsDefList);
  316.     if not (kScrapTEXT)
  317.         global kScrapTEXT             := 1;        # ScrapItem location of TEXT
  318.     
  319.     global kScrapPICT                 := assoc('kScrapPICT',pGlobalsDefList);
  320.     if not (kScrapPICT)
  321.         global kScrapPICT             := 2;        # ScrapItem location of PICT
  322.     
  323.     global gScrapTitle                 := assoc('gScrapTitle',pGlobalsDefList);
  324.     if not (gScrapTitle)
  325.         global gScrapTitle := 'Scrapbook';
  326.     
  327.     ############## Script Globals ############
  328.     global gAliasDirectory             := assoc('gAliasDirectory',pGlobalsDefList);
  329.     if not (gAliasDirectory)
  330.         global gAliasDirectory         := "#Aliases";    # Location of Core app aliases ( found in Apple Menu )
  331.     
  332.     global gTCTracking                 := assoc('gTCTracking',pGlobalsDefList);
  333.     if (IsUndefined(gTCTracking))
  334.         global gTCTracking            := 1;            # Set to true to do Suite & TCS logging
  335.     
  336.     global gPreFlight                := assoc('gPreFlight',pGlobalsDefList);
  337.     if (IsUndefined(gPreFlight))
  338.         global gPreFlight            := 1;        # Set to true if you want to be sure target can 
  339.                                                 # run app (see PreFlight task)
  340.  
  341.     global gLaunchReqs                := assoc('gLaunchReqs',pGlobalsDefList); # obtain launch requirements
  342.     
  343.     ############## font characteristic lists ############
  344.     global gFontList                 := assoc('gFontList',pGlobalsDefList);
  345.     if not (gFontList)
  346.         global gFontList             := { 'Chicago','Courier','Geneva','Helvetica','Monaco','New York','Times' };
  347.     
  348.     global gFontSizeList             := assoc('gFontSizeList',pGlobalsDefList);
  349.     if not (gFontSizeList)
  350.         global gFontSizeList         := { '9','10','12','14','18','24','36' };
  351.     
  352.     global gFontStyleList             := assoc('gFontStyleList',pGlobalsDefList);
  353.     if not (gFontStyleList)
  354.         global gFontStyleList := { 'Bold','Italic','Outline','Underline','Shadow' };
  355.  
  356.     ############################################################################
  357.     # gSFPUTLocation contains the path to the directory in which files will be saved
  358.     # by the NameOK Task. If the list is empty files will be saved in the default dir
  359.     # IMPORTANT:  gSFPUTLocation is a list
  360.     # for example:  global gSFPUTLocation := {"hd" };
  361.     ############################################################################
  362.     global gSFPUTLocation             := assoc('gSFPUTLocation',pGlobalsDefList);
  363.  
  364.     ############## Print Global  ############
  365.     global gPrintTest                 := assoc('gPrintTest',pGlobalsDefList);        # If true print test will be executed
  366.     
  367.     ############## DoWindows Globals ############
  368.     global gDoWindowList             := assoc('gDoWindowList',pGlobalsDefList);
  369.     if not (gDoWindowList)
  370.         global gDoWindowList := {1,1,1,1};
  371.         # Set each element to 1 or 0.  Flag for performing DoWindows tests as follows:
  372.         # Element:      1 - Sizing
  373.         #             2 - Scrolling
  374.         #             3 - Dragging
  375.         #             4 - Zooming
  376.  
  377.     ############## Launching/Quitting Globals ##################################
  378.         #  Quit() will close all windows, Launchtwitch() will background quit apps
  379.     global gBackgroundQuit             := assoc('gBackgroundQuit',pGlobalsDefList);
  380.     
  381.         # Overrides gBackgroundQuit.  Quit() does nothing, Launchtwitch() will
  382.         # twitch to and quit apps until it can complete launch.
  383.     global gForceQuit                 := assoc('gForceQuit',pGlobalsDefList);
  384.     
  385.     ############## Random Seeding Globals ##################################
  386.     global gSeedValue                 := assoc('gSeedValue',pGlobalsDefList);
  387.                                 # set seed value if reproducing tests. Undefined 
  388.                                 # generates a random seed value
  389.  
  390.     ############################################################################
  391.     ####### DO NOT modify any of the following GLOBAL Settings -      ############
  392.     ############################################################################
  393.     
  394.     if(TypeOf(pTheScriptParam) = 'list')
  395.         SetTestLevel(pTheScriptParam[1],pTheScriptParam[2]);
  396.     else if(TypeOf(pTheScriptParam) = 'integer')
  397.     begin
  398.          if(pTheScriptParam = -1)        # Default setting for the scriptParam
  399.             SetTestLevel(1);            # Default to Quicklook
  400.         else
  401.             SetTestLevel(pTheScriptParam);
  402.     end;
  403.     
  404.         ##################################################
  405.         ###    Test Case Logging Method Constants
  406.         ##################################################
  407.  
  408.     global kTCSNoLoggingMethod := 0;
  409.     global kTCSResultsExpressMethod := 1;
  410.     global kTCS_TRACSFileToolMethod := 2;
  411.     
  412.         ### gTestCaseLoggingMethod can have the following values:
  413.         # 0 - no test case logging
  414.         # 1    - log test cases using Results Express
  415.         # 2 - log test cases by creating TRACS import file on host
  416.         # 3 - log test cases with Results Express and TRACS
  417.     
  418.     if((gTestCaseLoggingMethod & kTCSResultsExpressMethod) and (gTestCaseLoggingMethod & kTCS_TRACSFileToolMethod))
  419.         global gIsBothMethods := TRUE;
  420.     else
  421.         global gIsBothMethods := FALSE;
  422.     
  423.     InitCustom();                    # Call to initialize any custom defined globals
  424.     
  425.     if (CommandExceptions())        # if we're throwing VU exceptions
  426.     begin
  427.         if (CommandTimeout() < 130)    # make sure timeout set to 130
  428.         begin
  429.             logstr('Command timeout reset to 130 for proper exception handling');
  430.             CommandTimeout(130);
  431.         end; 
  432.     end; 
  433.  
  434.     if(global gInitGlobalsThreadingHook)
  435.         call(gInitGlobalsThreadingHook);
  436.         
  437.     InitRandomSeed();
  438.     
  439.     if ((gTestCaseLoggingMethod = kTCS_TRACSFileToolMethod) or gIsBothMethods)
  440.     begin
  441.         logstr('TRACS import data will be generated using FileTool on the host');
  442.         
  443.         global gTRACS_OutputData := {};                    #Private Global for TRACS Output
  444.     
  445.         pTheScriptParam := {{"The Script Param", pTheScriptParam }};
  446.      
  447.         TRACS_DataCollection(pTheScriptParam, 0);
  448.     end;
  449.     else
  450.         logstr('TRACS import data will not be generated');
  451.     
  452.     
  453. end; # InitGlobals
  454.  
  455. #########################################################################
  456. #                        InitRandomSeed()
  457. #========================================================================
  458. # Author:        ML
  459. # Description:    Initializes the random seed. 
  460. # Parameters:    None
  461. # Returns:        Nada
  462. # Examples:        InitRandomSeed();
  463. # Assumptions:    
  464. #========================================================================
  465. # History:
  466. #    ML    7/15/94    Correct globals declarations
  467. #    ML    12/13/94    Removed gSeedZero
  468. #    KTA    1/9/95    Changes Println call to Logstr() call.
  469. ########################################################################
  470. TASK InitRandomSeed()
  471. begin
  472.     global gSeedValue;
  473.     if (IsUndefined(gSeedValue))
  474.         gSeedValue:= random();        # generate a random seed
  475.     
  476.     randomseed(gSeedValue);            # seed the random number generator
  477.     
  478.     LogStr("The seed value is {gSeedValue}");    # print out the seed value for posterity
  479.     
  480. end; # InitRandomSeed()
  481.  
  482. #########################################################################
  483. #            SetTestLevel(pTestLevel := 1, pCustomSetting := {})
  484. #========================================================================
  485. # Author:        KTA 
  486. # Description:    Will set globals that will determine the level of testing 
  487. #                that will occur in the DoTests.
  488. # Parameters:    pTestLevel := Generic level of testing desired.
  489. #                            1 - least amount of testing
  490. #                            2 - medium amount of testing
  491. #                            3 - Most amount of testing
  492. #                pCustomSetting - Any Custom settings, this will override the 
  493. #                                generic settings for any specified global setting.
  494. # Returns:        
  495. # Examples:        SetTestLevel( 1, {{'DrawLevel', {1,2}}} ); 
  496. # Assumptions:    Note : the labels used to set individual methods are as follows:
  497. #                        1) DrawLevel
  498. #                        2) FontLevel
  499. #                        3) WindowLevel
  500. #                        4) AppTestLevel
  501. #========================================================================
  502. # History:
  503. # KTA    9/9/93    Added support for gAppTestLevel
  504. #    KTA    1/9/95    Changes Println calls to Logstr() calls.
  505. #    KTA    1/27/95    Fixed illegal expression with 'WindowLevel'
  506. #    KTA    2/23/95    Fixed example in header and added more detail about test methods
  507. #########################################################################
  508. TASK SetTestLevel(pTestLevel := 1, pCustomSetting := {})
  509. begin
  510.     if(pTestLevel = 0)
  511.     begin
  512.         LogStr( "==== The test level is '{pTestLevel}' - (Turn all DoTests - OFF) =====");
  513.         
  514.         global gFontLevel := 0;
  515.         global gDrawLevel := 0;
  516.         global gWindowLevel := 0;
  517.         global gAppTestLevel := 0;
  518.     end;
  519.     else if(pTestLevel = 1)
  520.     begin
  521.         LogStr("==== The test level is '{pTestLevel}' - (Minimum amount of testing) =====");
  522.         
  523.         global gFontLevel := 1;
  524.         global gDrawLevel := 1;
  525.         global gWindowLevel := 1;
  526.         global gAppTestLevel := 1;
  527.     end;
  528.     else if(pTestLevel = 2)
  529.     begin
  530.         LogStr("==== The test level is '{pTestLevel}' - (Medium amount of testing) =====");
  531.         
  532.         global gFontLevel := 2;
  533.         global gDrawLevel := 2;
  534.         global gWindowLevel := 2;
  535.         global gAppTestLevel := 2;
  536.     
  537.     end;
  538.     else if( pTestLevel = 3)
  539.     begin
  540.         LogStr( "==== The test level is '{pTestLevel}' - (Most amount of testing) =====");
  541.         
  542.         global gFontLevel := {2,3};
  543.         global gDrawLevel := {2,3};
  544.         global gWindowLevel := {2,3};
  545.         global gAppTestLevel := 3;
  546.     end;
  547.     
  548.     
  549.     if (pCustomSetting)
  550.     begin
  551.         for each testLevel in pCustomSetting
  552.         begin
  553.             whichMethod := testLevel[1];
  554.             testsettings := testLevel[2];
  555.             if(whichMethod = 'DrawLevel')
  556.             begin
  557.                 LogStr("    Custom gDrawLevel := {testsettings}");
  558.                 global gDrawLevel := testsettings;
  559.             end;
  560.             else if(whichMethod = 'FontLevel')
  561.             begin
  562.                 LogStr( "    Custom gFontLevel := {testsettings}");
  563.                 global gFontLevel := testsettings;
  564.             end;
  565.             else if(whichMethod = 'WindowLevel')
  566.             begin
  567.                 LogStr( "    Custom gWindowLevel := {testsettings}");
  568.                 global gWindowLevel := testsettings;
  569.             end;
  570.             else if(whichMethod = 'AppTestLevel')
  571.             begin
  572.                 LogStr( "    Custom gAppTestLevel := {testsettings}");
  573.                 global gAppTestLevel := testsettings;
  574.             end;
  575.         end;
  576.     end;
  577. end; # SetTestLevel()
  578.  
  579.